/**递归的recuesion
 * @author yuisama
 * @date 2022/03/21 17:28
 **/
import java.util.Scanner;
public class Recursion {
    public static void main(String[] args) {
        System.out.println("请输入一个整数");
        Scanner scanner = new Scanner(System.in);
        int a = scanner.nextInt();
        System.out.println(factor(a));
    }

    //写一个递归函数实现5！
    public static int factor (int  num){
       //递归函数，先写终止条件
       if(num == 1){
           return num;
       }
       return num* factor (num -1);
    }
}
